home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMIBEST1.ADF / AmigaBasicStuff / IFFBrush2BOB < prev    next >
Text File  |  1987-07-22  |  3KB  |  102 lines

  1. CLEAR, 30000&
  2. SCREEN 1,640,200,2,2
  3. WINDOW 1,"IFF.EDITOR",,15,1
  4.   START:
  5. DIM BODY$(5,200)  
  6. CLS:BEEP
  7. PRINT "** PLACE THE DISK CONTAINING THE FILE YOU WANT TO EDIT IN THE DRIVE"
  8. PRINT "** AND TYPE IN ITS COMPLETE PATHNAME, AS IN THE FOLLOWING EXAMPLE"
  9. PRINT
  10. PRINT "       DF0:BRUSH/WIZARD           "
  11. PRINT
  12. INPUT "** PRESS  <RETURN> WHEN FINISHED --->  ",FILENAME$
  13. OPEN FILENAME$ FOR INPUT AS 1
  14.  
  15.   READ.FILE:
  16.  
  17. JUNK=CVL(INPUT$(20,#1))
  18. WYDTH=CVI(INPUT$(2,#1)):HEIGHT=CVI(INPUT$(2,#1))  ' WIDTH &HEIGHT IN PIXELS
  19. JUNK=CVL(INPUT$(4,#1))
  20. PLANES=ASC(INPUT$(1,#1))      ' # OF BIT-PLANES 
  21. MASK=ASC(INPUT$(1,#1))        ' THE TRANSPARENCY REGISTER
  22. COMPTYPE=ASC(INPUT$(1,#1))    ' COMPRESSION TYPE
  23. JUNK=ASC(INPUT$(1,#1))
  24. JUNK=CVI(INPUT$(2,#1))
  25. HASPECT=ASC(INPUT$(1,#1)):VASPECT=ASC(INPUT$(1,#1))   '  RESOLUTION 
  26.  IF PLANES=5 THEN
  27.  JUNK=CVL(INPUT$(124,#1))
  28.    ELSEIF PLANES=4 THEN
  29.    JUNK=CVL(INPUT$(76,#1))
  30.     ELSE 
  31.     JUNK=CVL(INPUT$(52,#1))
  32. END IF 
  33. SIZE=CVL(INPUT$(4,#1))
  34. ROWBYTES%=INT((WYDTH-1)/16+1)*2       '  This is the hard part 
  35.  FOR I=0 TO HEIGHT-1                 '   that Lee Savory helped with
  36.   FOR J=0 TO PLANES-1
  37.    BODY$(J,I)=INPUT$(ROWBYTES%, #1)
  38.   NEXT J
  39.  NEXT I
  40. CLOSE #1  
  41.  
  42.   PRINT.SPECS:
  43.   
  44. XC=2^INT(PLANES)-1 : REM TOTAL# OF COLORS
  45. IF INT(HASPECT)=10 THEN RES=320 ELSE RES=640
  46. PRINT "       YOUR FILE:  "; FILENAME$ :PRINT
  47. PRINT " WIDTH IN PIXELS: ";WYDTH,: PRINT "HEIGHT IN PIXELS: ";HEIGHT :PRINT
  48. PRINT " # OF BIT-PLANES: ";PLANES,: PRINT XC+1; " COLORS" :PRINT
  49. PRINT " THE RESOLUTION IS "; RES ;: PRINT " X  200 "
  50. PRINT " THE SIZE OF THE BODY IS"; SIZE
  51. PRINT:PRINT
  52.  
  53.   WRITE.FILE:
  54.   
  55. PRINT " PUT DISK IN DRIVE AND TYPE COMPLETE PATHNAME OF FILE YOU WANT"
  56. PRINT " TO CREATE      (EXAMPLE--DF0:BLOB  "
  57. INPUT " PRESS RETURN WHEN FINISHED ---> ",FILEOUT$
  58. OPEN FILEOUT$ FOR OUTPUT AS 2
  59. PRINT #2, MKL$(0);
  60. PRINT #2, MKL$(0);
  61. PRINT #2, MKL$(PLANES);
  62. PRINT #2, MKL$(WYDTH);
  63. PRINT #2, MKL$(HEIGHT);
  64. PRINT #2, MKI$(24); 
  65. PRINT #2, MKI$(XC);        
  66. PRINT #2, MKI$(0);
  67.  FOR J=0 TO PLANES-1
  68.   FOR I=0 TO HEIGHT-1
  69.    PRINT #2, BODY$(J,I);
  70.   NEXT I
  71.  NEXT J
  72. CLOSE #2
  73.  
  74. INPUT " TYPE <1> TO EDIT ANOTHER FILE, OR <2> TO QUIT ",S
  75. ON S GOTO RESTART, QUIT
  76.  
  77.   RESTART:
  78.     CLEAR : GOTO START
  79.   
  80.   QUIT:
  81. END
  82.  
  83. '               **  Instructions, sort of  **
  84. ' This editor will convert a BRUSH created in Deluxe Paint into
  85. ' the format required for a BOB by the OBJECT.SHAPE statements in AmigaBasic.
  86. ' The brush can be in 320 or 640 X 200 or 400 resolution and in 32, 16, or 
  87. ' 8 colors.
  88. ' At the moment the Deluxe Paint file cannot be compressed.
  89. ' An approximate safe  max. size is 40 pixels wide X 90 pixels tall--
  90. ' An "input past end" error when loading the IFF file means you're
  91. ' trying to read a compressed file.
  92. '   Graphicraft (v. 1) doesn't compress files, so this editor could read
  93. '   a full screen, if you can then figure out how to stuff the resulting
  94. '   41 K or so into a BASIC array to PUT it on the screen.....
  95. ' If you want more information on BOB and SPRITE file formats, list the
  96. ' Object.editor program in the demos on the EXTRAS disk.  For more info on
  97. ' IFF files, see all the stuff on Compuserve, especially a file called
  98. ' "IFF.text", which describes the file format. 
  99. '       Fiddle with this, please!! It needs a decompression routine!
  100. '        --Mike Swinger  3/2/86  Columbus ASIG     
  101.  
  102.